package com.pzhu.filter;

import com.pzhu.controller.impl.BookControllerImpl;

import javax.servlet.*;
import java.io.IOException;

public class AddBookFilter implements Filter {
    BookControllerImpl bookController = new BookControllerImpl();
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {

    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        System.out.println("addBookFilter 执行");
        long lastId = bookController.selectLastId();
        servletRequest.setAttribute("lastId",lastId);
        filterChain.doFilter(servletRequest,servletResponse);
    }

    @Override
    public void destroy() {

    }
}
